package com.borko.healthcare.entities.beans;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import com.borko.healthcare.entities.interfaces.MedicineOrder;
import com.borko.healthcare.entities.interfaces.Notification;
import com.borko.healthcare.entities.interfaces.Pharmacist;
import com.borko.healthcare.entities.interfaces.Supplier;

@Entity
@Table(name = "NOTIFICATIONS")
public class NotificationBean implements Notification {

	@Id @GeneratedValue
	@Column(name = "NOTIFICATION_ID")
	private int id;
	
	@OneToMany(targetEntity = MedicineOrderBean.class)
	@LazyCollection(LazyCollectionOption.FALSE)
	private List<MedicineOrder> medicineOrders;
	
	@ManyToOne(targetEntity = SupplierBean.class, optional = true)
	@JoinColumn(name = "SUPPLIER_ID", updatable = false)
	private Supplier supplier;
	
	@ManyToOne(targetEntity = PharmacistBean.class, optional = true)
	@JoinColumn(name = "PHARMACIST_ID", updatable = false)
	private Pharmacist pharmacist;
	
	public NotificationBean() {	
		medicineOrders = new ArrayList<MedicineOrder>();
	}

	public int getId() {
		return id;
	}

	public List<MedicineOrder> getMedicineOrders() {
		return medicineOrders;
	}

	public void setMedicineOrders(List<MedicineOrder> medicineOrders) {
		this.medicineOrders = medicineOrders;
	}

	public Supplier getSupplier() {
		return supplier;
	}

	public void setSupplier(Supplier supplier) {
		this.supplier = supplier;
	}

	public Pharmacist getPharmacist() {
		return pharmacist;
	}

	public void setPharmacist(Pharmacist pharmacist) {
		this.pharmacist = pharmacist;
	}
}
